package com.aegis.spring.config;

import cn.dev33.satoken.config.SaTokenConfig;
import com.aegis.core.constants.AegisCommonConstants;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;

/**
 * @Author wuweixin
 *
 * @Version 1.0
 * @Descritube
 */
public class SaInitConfig {

    @Autowired
    private SaTokenConfig saTokenConfig;

    @Autowired
    private AegisUserProperties aegisUserProperties;

    @PostConstruct
    public void init() {
        if (aegisUserProperties.getTokenConfig() != null) {
            BeanUtils.copyProperties(aegisUserProperties.getTokenConfig(), saTokenConfig);
        }
        saTokenConfig.setTokenName(AegisCommonConstants.DEFAULT_TOKEN_NAME);
    }


}
